package com.xmy.cultivate.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.xmy.cultivate.entity.Quarter;
import com.xmy.cultivate.entity.RadeFiducial;
import com.xmy.cultivate.entity.RadeFiducialSet;
import com.xmy.cultivate.entity.response.LackRecourseRate;
import com.xmy.cultivate.service.IRadeFiducialService;
import com.xmy.cultivate.util.Code;
import com.xmy.cultivate.util.PageResult;
import com.xmy.cultivate.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 率的基准值 前端控制器
 * </p>
 *
 * @author hpiggy
 * @since 2025-04-26
 */
@RestController
@RequestMapping("/api/radeFiducial")
public class RadeFiducialController extends BaseController {

    @Autowired
    IRadeFiducialService iRadeFiducialService;

    @GetMapping("")
    public Result getRadeFiducialList(@RequestParam(value = "yearPart", required = true) Integer yearPart,
                                      @RequestParam(value = "quarterNum", required = true) Integer quarterNum,
                                      @RequestParam(value = "projectsId", required = false, defaultValue = "") Integer projectsId,
                                      @RequestParam(value = "lessonType", required = false, defaultValue = "") Integer lessonType,
                                      @RequestParam(value = "subjectsId", required = false, defaultValue = "") Integer subjectsId) {

        QueryWrapper<RadeFiducial> radeFiducialSetQueryWrapper = new QueryWrapper<>();
        radeFiducialSetQueryWrapper.eq("projects_id", projectsId);
        radeFiducialSetQueryWrapper.eq("lesson_type", lessonType);
        radeFiducialSetQueryWrapper.eq("subjects_id", subjectsId);
        radeFiducialSetQueryWrapper.eq("year_part", yearPart);
        radeFiducialSetQueryWrapper.eq("quarter_num", quarterNum);

        List<RadeFiducial> radeFiducialSetList = iRadeFiducialService.list(radeFiducialSetQueryWrapper);

        return new Result(Code.OK, radeFiducialSetList, Code.GET_OK_MSG);
    }


}
